package esempi;

public class TestVarArg {

	public static void main(String[] args) {

		int a = max(10, 20, 6, 5);
		int b = max(2, 3, 7);

		System.out.println(a);
		System.out.println(b);

	}

	private static int max(int... a) {

		int max = a[0];
		for (int i = 0; i < a.length; i++) {
			if (a[i] > max) {
				max = a[i];

			}

		}
		return max;
	}

}
